#!/usr/bin/python

import codecs,sys

fin=codecs.open("pctb5.sen.merged",'r','utf-8')
fc=codecs.open("pctb5.sen.align.chi",'w','utf-8')
fe=codecs.open("pctb5.sen.align.eng",'w','utf-8')

lines=fin.readlines()
fin.close()
maxlen=len(lines)
i=0
while True:
	if i >= maxlen:
		break
	if len(lines[i].strip())==0:
		i += 1
		continue
	else:
		fe.write(lines[i])
		i += 1
		if i<maxlen and len(lines[i].strip())>0:
			fc.write(lines[i])
			i += 1
		else:
			print i, #"|||",lines[i-1],"|||",lines[i]
			print "error and quit."
			sys.exit(1)

fc.close()
fe.close()
